package cn.yuxiaoyuan.feign;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.yuxiaoyuan.pojo.domain.Login;
import cn.yuxiaoyuan.pojo.dto.LoginDto;
import cn.yuxiaoyuan.result.JSONResult;
import cn.yuxiaoyuan.service.ILoginService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author solargen
 * @version 1.0
 * @date 2025/6/16 11:37
 */
@RestController
@Validated
@RequestMapping("/manager/login")
@Tag(name = "登录对象远程API")
public class LoginFeignApiImpl implements LoginFeignApi{
    @Autowired
    private ILoginService loginService;
    @Override
    @SaIgnore
    @PostMapping("/create")
    public JSONResult create(LoginDto loginDto) {
        Login login = new Login();
        BeanUtils.copyProperties(loginDto,login);
        loginService.save(login);
        return JSONResult.success();
    }
}
